package test;

public class game_fighting {
    public static void main(String[] args) {
        //创建角色
        Role r1=new Role("qiaofeng",100,'男');
        Role r2=new Role("jiumozhi",100,'女');

        //显示角色信息
        r1.showRoleInfo();
        r2.showRoleInfo();

        //开始格斗，回合制游戏
        while(true){
            //r1开始攻击r2
            r1.attack(r2);
            //判断r2的剩余血量
            if(r2.getBlood()==0){
                System.out.println(r1.getName()+"KO 了"+r2.getName());
                break;
            }

            //r2开始共极r1
            r2.attack(r1);
            if(r2.getBlood()==0){
                System.out.println(r2.getName()+"KO 了"+r1.getName());
                break;
            }
        }
    }
}
